package jmcnet.libcommun.communs.structures
{
	/**
	 * A filo stack. You use it by calling to push one elt, and pop to pop the recently pushed elt
	 */
	public class FiloStack
	{
		private var _elts:Array=new Array();
		public function FiloStack()	{ }
		
		/**
		 * Push one elt on bottom of the FifoStack.
		 * @return the number of elts in the stack
		 * */
		public function push(elt:Object):uint {
			_elts.push(elt);
			return _elts.length;
		}
		
		/**
		 * Pop the elt on the bottom of the FifoStack (the last inserted element).
		 * @return Returns the elt poped
		 */
		public function pop():Object {
			if (_elts.length <= 0) return null;
			return _elts.pop();
		}
		
		/**
		 * Gets the length of the stack.
		 */
		public function get length():uint {
			return _elts.length;
		}
	}
}